<template>
  <div class="shop">
    <el-table :data="tableData" border style="width: 100%">
      <el-table-column prop="name" align="center" label="商铺名" />
      <el-table-column prop="photo" align="center" label="图片">
        <template slot-scope="scope">
          <img :src="scope.row.photo" style="width:100px;height:80px;" alt="">
        </template>
      </el-table-column>
      <el-table-column prop="phone" align="center" label="联系方式" />
      <el-table-column prop="area" align="center" label="地址" />
      <el-table-column label="操作" align="center">
        <template slot-scope="scope">
          <el-button size="small" type="success" @click="handleClick(scope.row)">查看详情</el-button>
        </template>
      </el-table-column>
    </el-table>
    <!-- 分页 -->
    <el-col :span="24" class="toolbar" style="text-align: center;">
      <el-pagination
        background
        :current-page="currentPage"
        :page-count="pageNum"
        :page-size="pagesize"
        style="margin-top:30px;margin-bottom:30px"
        layout="total, prev, pager, next, jumper"
        :total="total"
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
      />
    </el-col>
  </div>
</template>
<script>
export default {
  data() {
    return {
      currentPage: 1, // 初始页
      pagesize: 10, // 当前页面内的列表行数
      pageCount: 1,
      pageNum: 1, // 页数
      total: 2,
      tableData: [
        {
          name: '世纪华联',
          photo: 'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1577350774&di=5aa7c4d9d34ece3b073edf75785e6af4&imgtype=jpg&er=1&src=http%3A%2F%2Fhiphotos.baidu.com%2Fmap%2Fpic%2Fitem%2F738b4710b912c8fc3469089dfb039245d78821cc.jpg',
          phone: '13455555555',
          area: '浙江省杭州市下城区下沙大都会风情苑北门左一'
        },
        {
          name: '天猫超市',
          photo: 'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1576756033648&di=90614ffe86d10a761ac663c221df1fcc&imgtype=0&src=http%3A%2F%2Fi3.hoopchina.com.cn%2Fhupuapp%2Fbbs%2F153523627868116%2Fthread_153523627868116_20190511034227_s_30527_w_342_h_256_88428.jpg%3Fx-oss-process%3Dimage%2Fresize%2Cw_800%2Fformat%2Cjpg',
          phone: '13456867816',
          area: '浙江省杭州市下城区下沙大都会风情苑北门右一'
        }
      ]
    }
  },
  mounted() {},
  methods: {
    handleClick(row) {
      this.$router.push({ name: '周边店铺详情', params: { data: row }})
    },
    // 当前页
    handleSizeChange: function(pagesize) {
      this.pagesize = pagesize
    },
    // 换页：更新列表数据
    handleCurrentChange: function(currentPage) {
      this.currentPage = currentPage
    }
  }
}
</script>
<style lang="scss" scoped>
.shop {
  margin-top: 55px;
}
</style>
